package com.xinxin.intelligenceexam.domain;

import android.os.Parcel;
import android.os.Parcelable;

public class Question implements Parcelable {
    private Integer id;

    private String content;

    private Integer hasPic;

    private String picUrl;

    private String answer;

    private Integer type;//0--单选

    public Question(Integer id, String content, Integer hasPic, String picUrl, String answer, Integer type) {
        this.id = id;
        this.content = content;
        this.hasPic = hasPic;
        this.picUrl = picUrl;
        this.answer = answer;
        this.type = type;
    }
    public Question(String content, Integer hasPic, String picUrl, String answer, Integer type) {
        this.id = id;
        this.content = content;
        this.hasPic = hasPic;
        this.picUrl = picUrl;
        this.answer = answer;
        this.type = type;
    }

    public Question() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    public Integer getHasPic() {
        return hasPic;
    }

    public void setHasPic(Integer hasPic) {
        this.hasPic = hasPic;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl == null ? null : picUrl.trim();
    }

    public String getAnswer() {
        return answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer == null ? null : answer.trim();
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "Question{" +
                "id=" + id +
                ", content='" + content + '\'' +
                ", hasPic=" + hasPic +
                ", picUrl='" + picUrl + '\'' +
                ", answer='" + answer + '\'' +
                ", type=" + type +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.content);
        dest.writeValue(this.hasPic);
        dest.writeString(this.picUrl);
        dest.writeString(this.answer);
        dest.writeValue(this.type);
    }

    protected Question(Parcel in) {
        this.id = (Integer) in.readValue(Integer.class.getClassLoader());
        this.content = in.readString();
        this.hasPic = (Integer) in.readValue(Integer.class.getClassLoader());
        this.picUrl = in.readString();
        this.answer = in.readString();
        this.type = (Integer) in.readValue(Integer.class.getClassLoader());
    }

    public static final Parcelable.Creator<Question> CREATOR = new Parcelable.Creator<Question>() {
        @Override
        public Question createFromParcel(Parcel source) {
            return new Question(source);
        }

        @Override
        public Question[] newArray(int size) {
            return new Question[size];
        }
    };
}